package com.it.mycharsetstream;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class CharsetStreamDemo2 {
    public static void main(String[] args) throws IOException {
        //1.创建对象
        FileReader fr = new FileReader("D:\\java\\basic-code\\myio\\src\\a.txt");
        char[] chars = new char[2];
        int len;
        //read(chars)：读取数据，解码，强转三步合并了，把强转之后的字符放到数组当中
        //空参的read+强转
        while((len = fr.read(chars)) != -1 ){
            System.out.println(new String(chars, 0, len));
        }

        fr.close();
    }
}
